﻿<style>

		#tool {
		    display:none;
		    position:absolute;
		    z-index:1000;
		    -moz-border-radius:4px;
		    -webkit-border-radius:4px;
		}

		.tooltip-style1 {
			background:#5a85a5 10px center no-repeat;
			color:white;
			min-height:30px;
			padding:10px 20px 10px 10px;
			opacity:0.95;
			
		}
		.tooltip-style2 {
			background:#363636;
			padding:3px;
			color:white;
			text-align:center;
		}



		pre {
			font-size:10px;
		}
		
	</style>

<div id="pagecontent">
<?php 
	if($this->session->flashdata('message')!='')
	{ 
		
?>
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="305px" height="50px" bgcolor="#FF0000"><tr><td>
<table width="300px" height="45px" bgcolor="#FFFFCC"><tr><td align="center" valign="middle">
<?php echo $this->session->flashdata('message'); ?>
</p>
</td></tr></table></td></tr></table>
</div>
<?php
	}
	$option_arr=array('0' => "All",'1' => "Pending", '2' => 'Processing', '3' => "Finished");
	
?>
<div id="listmenu" align="center" style="width:100%; padding-left:0px;"> <div class="error_validate" id="error_message"></div>
<div align="left">
<form action="<?php echo base_url().index_page()."/adminpage/cpanel/reservations_manager/"; ?>" name="searchfrm" method="post">
<label style="width:80"><span style="color:#069; font-weight:bold; text-decoration:underline">Choose status for filter:</span></label>
<span style="float:left;" class="tooltips" id="header_wrapper"><img src="<?php echo base_url(); ?>assets/img/help.jpg" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div id='tool' class="tooltip-style1">
<strong>Status of Reserve</strong>:
<br />
<ul style="padding-left:15px; margin-left:15px">
<li><em>All</em>: display all reserves</li>
<li><em>Pending</em>: Latest reserves without checking</li>
<li><em>Processing</em>: You have checked these reserves</li>
<li><em>Finished</em>: Customer has been served</li>
</ul>
<strong>Keyword</strong>: List the particular results
<br />
<ul style="padding-left:15px; margin-left:15px">
<li><em>Fields can be searched</em>: Fullname, Email, Mobile, Comment, Date</li>
<li><em>Auto remember</em>: System will remember the status and keyword automatically</li>
<li><em>Clear remember</em>: Delete keyword and choose Status then press Search</li>

</ul>
</div>
</span>
<select  name="search_option">
<?php

	//if (array_key_exists($row->id, $promotion_array))
	for($i=0;$i<count($option_arr);$i++)
	{
		echo "<option value=".$i;
		if ($this->session->userdata('search_option_cv')==$i)
		{ 
			echo " selected='selected'";
		}
		echo " >&nbsp;".$option_arr[$i]."&nbsp;</option>";
	}

?>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#069; font-weight:bold; text-decoration:underline">Keyword:</span>&nbsp;&nbsp;<input id="keyword" name="keyword" type="text" size="30" maxlength="50" value="<?php echo $this->session->userdata('keyword_cv'); ?>"/>
<input name="Search" type="submit" value="Search"/>
</form>
</div>


<table width="100%" id="tablesorter-demo" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
  <thead>
  <tr>
    <th align="center" width="33%">User Information</th>
    <th align="center" width="35%">Reserve detail</th>
    <th align="center" width="12%">Status</th>
    <th align="center" width="20%" class="{sorter: false}"><?php echo $this->lang->line('table_header_action'); ?></th>
  </tr>
  </thead>
  <tbody>
<?php 
$i=0;
				foreach($reservations as $reserve)
				{	
					
					$td_bg=($i%2==0)?"":" background-color:#f0f0f6";
					$ad_info="<strong>Reservation</strong>: ".$reserve['reservation']."<br /><strong>Time - Date</strong>: ".$reserve['time']." ".$reserve['date']."<br />
<strong>Number of person</strong>: ".$reserve['number_person']."<br /><strong>Comment</strong>: ".$reserve['comment'];
?>	
				
<tr><td style="padding-left:10px;<?php echo $td_bg; ?>;" ><div style="display:none"><?php echo $reserve['jobseeker_id']; ?></div><strong>Fullname</strong>: <?php echo $reserve['first_name']." ".$reserve['surname']; ?><br /><strong>Email</strong>: <?php echo $reserve['email']; ?><br /><strong>Phone</strong>: <?php echo $reserve['phone']; ?><br /><strong>Fax</strong>: <?php echo $reserve['fax']; ?><br /><strong>Mobile</strong>: <?php echo $reserve['mobile']; ?><br /><strong>Member</strong>: <?php echo $reserve['member']; ?></td>
<td align="left"  style="padding-left:10px;<?php echo $td_bg; ?>"><div style="display:none"><?php echo $reserve['order_id']; ?></div>
<?php echo $ad_info; ?>

</td>
<td  align='center' style=" <?php echo $td_bg; ?>">
<?php 
		//echo $reserve['status']==1?"<span  style='color:#06C'>Active</span>":"Inactive"; 
		if($reserve['status']==0)
		{
			echo "Pending";
		}
		else if($reserve['status']==1)
		{
			echo "Processing";
		}
		else
		{
			echo "Finished";
		}
?>
</td>
 <td align='center' width='30%'  style=" <?php echo $td_bg; ?>"><a  style='color:#FF3366; text-decoration:underline;cursor:pointer' href='<?php echo base_url().index_page()."/adminpage/cpanel/show_status_reserve/".$reserve['order_id']."/".$reserve['status']; ?>?height=100&width=300&modal=true' class='thickbox'>Update status</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a style='cursor:pointer' onclick='checkdelete(<?php echo $reserve['order_id']; ?>)'>Delete</a></td></tr>

<?php 		
				$i++;
				}
?> 
  </tbody>
</table>
  </div> 
<?php
		if ($this->pagination->create_links()!='')
		{
			 echo '<p align="right"><strong>Page </strong><span style="color:#FF0000">'.$this->pagination->create_links(); 
		}
?>  
<p>&nbsp;</p>
</div>

<script>
function show_detail(id)
{
  $(document).ready(function(){
	  //$("#addmenu").show('slow');
	  $('#show'+id).toggle(400); // First click should toggle to 'show'
      return false;
    });
}

$(document).ready(function() { 
    $("#tablesorter-demo").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the third column (we start counting zero) 
            3: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            } 
        } 
    }); 
});
function checkdelete(id)
{	
	var value = confirm("<?php echo $this->lang->line('meg_confirm') ?>");
	if (value==false)
	{
		return;
	}
	else
	{
		location.href='<?php echo base_url().index_page()."/adminpage/cpanel/delete_reserve/"; ?>'+id;
	}
}

	$(document).ready(function() {
 		$(".tooltips").hover(
			function() { $(this).contents("div:last-child").css({ display: "block" }); },
			function() { $(this).contents("div:last-child").css({ display: "none" }); }
		);

		$(".tooltips").mousemove(function(e) {
			var mousex = e.pageX -120;
			var mousey = e.pageY;
			$(this).contents("div:last-child").css({  top: mousey, left: mousex });
		});
 	});


/*function checkdate()
{	
	if ((document.searchfrm.search_option.selectedIndex == 2) && (document.getElementById('keyword').value!=''))
	{
		str=document.getElementById('keyword').value;
		document.getElementById('keyword').value=str.replace(/\s/g, "");
		var v = new RegExp();
		v.compile("^(3[01]|[12][0-9]|0[1-9])-(1[0-2]|0[1-9])-[0-9]{4}$");
		if (!v.test(document.getElementById('keyword').value)) 
		{
			//alert('Please fill the correct date format. Example: 27-02-2009');
			document.getElementById("error_message").innerHTML="Please fill the correct date format. Example: 27-02-2009";
			return false;
		}
		else
		{
			document.searchfrm.submit();
		}
	}
	else
	{
		document.searchfrm.submit();
	}
}*/
</script>